<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <%@include file="/resources/datepicker/datepicker.jsp"%>
    <title><spring:message code="title.ipic.target"/></title>
      <style type="text/css">
        .font_stress{
            color: red;font-size: 13px;font-weight:bold;
        }
    </style>
    <script type="text/javascript">
          var datagrid;
	        $(function() {
	            datagrid=$('#datagrid').datagrid({
	                onDblClickCell:function(rowIndex){
	                    var rows = datagrid.datagrid('getRows');
	                    for ( var i = 0; i < rows.length; i++) {
	                         datagrid.datagrid('endEdit', i);
	                    }
	                        datagrid.datagrid('beginEdit', rowIndex);
	                }
	            });
	           $('#supplierId').combogrid({
                panelWidth:300,
                idField:'id',
                textField:'code',
                fitColumns:true,
                nowrap:true,
                editable:false,
                pagination:{showPageList:false,showRefresh:false},
                url:'${path}/basedata/supplier/ajaxList.do',
                frozenColumns:[[
                    {field:'id',title:'ID',checkbox:true}
                ]],
                columns:[[
                    {field:'code',title:'供应商代码',width:140},
                    {field:'name',title:'供应商名称',width:160},
                    {field:'linkman',title:'质量负责人',width:140}
                ]],
                onSelect:function(rowIndex, rowData){
                    $("#supplierName").val(rowData['name']);
                } 
            });
	            
	        });
	        
	       function save_(){
          
            var v1 = $("#planificationDates").val();
		    if(v1==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','计划日期不能为空!');
		            return;
		    }
		   var v2 = $("#certificationDates").val();
		    if(v2==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','审核日期不能为空!');
		            return;
		    }
          
           var v3 = $("#requestActionDates").val();
		    if(v3==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','要求行动的日期不能为空!');
		            return;
		    }
		    
		    var v4 = $("#actionIncomingDates").val();
		    if(v4==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','行动来临的日期不能为空!');
		            return;
		    }
		    
		    var v5 = $("#agreedActionDates").val();
		    if(v5==''){
		            $.messager.alert('<spring:message code='msg.tip'/>','同意行动的日期不能为空!');
		            return;
		    }
          
	         var isV =$("#tableForm").form("validate");
            if(!isV) return; 
            imonJYRH.showZone();
            $.ajax({
                url : '${path}/business/supplier_quality/audit/ajaxAdd.do',
                  data : $("#tableForm *").serialize(),
                 cache : false,
                 async : true,
                 dataType : "json",
                success : function(reMsg) {
                    if(reMsg.success){
                        parent.returnResult();
                        message.show({ msg : reMsg.msg,title : '<spring:message code='msg.tip'/>',showType:'slide'});
                    }else{
                        if(!imonJYRH.isBlank(reMsg.obj)){
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['obj']);
                        }else{
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['msg']);
                        }
                    }
                    imonJYRH.hideZone();
                }
            });
        }
        
      
    </script>
</head>
<body>
<table width="100%" id="tableForm" class="tableForm">

 		  <tr>
                    <td align="right"> <span style="color:red;">*</span>SupplierCode供应商编码：</td>
                    <td>
                        <input type="text" id="supplierId" name="supplierId" disabled data-options="required:true" value="${vo.id}"/>
                    </td>
                    <td align="right">SupplierName供应商名称：</td>
                    <td>
                        <input type="text" disabled name="supplierName" id="supplierName" value="${vo.name}"/>
                    </td>
           </tr>
       <tr>
        <td align="right"><span style="color:red;">*</span>Project项目：</td>
        <td>
            <input type="text" name="project" data-options="required:true" class="easyui-validatebox"/>
        </td>
        <td align="right"><span style="color:red;">*</span>Auditor审核者：</td>
        <td>
            <input type="text" name="auditor" data-options="required:true" class="easyui-validatebox"/>
        </td>
  </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span>Audit Code审核编码：</td>
        <td>
            <input type="text" name="code" data-options="required:true" class="easyui-validatebox"/>
        </td>
          <td align="right"><span style="color:red;">*</span>Evaluation Value估值： </td>
        <td>
            <input type="text" name="value" data-options="required:true" class="easyui-numberbox"/>
        </td>
    </tr>
    <tr>
        <td align="right"><span style="color:red;">*</span>Planification Date计划日期：</td>
        <td>
            <input type="text"  name="planificationDates" id="planificationDates"  data-options="required:true"  onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
   	     <td align="right"><span style="color:red;">*</span>Certification Date审核日期：</td>
        <td>
            <input type="text"  name="certificationDates"  id="certificationDates"   data-options="required:true"  onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
    </tr>
    
    <tr>
        <td align="right"><span style="color:red;">*</span>Requested Actions Date要求行动的日期： </td>
        <td>
            <input type="text"   name="requestActionDates"   id="requestActionDates"  data-options="required:true"  onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
        <td align="right"><span style="color:red;">*</span>Action Incoming Date行动来临的日期： </td>
        <td>
            <input type="text"  name="actionIncomingDates"  id="actionIncomingDates"  data-options="required:true"  onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
    </tr>
    <tr>
       <td align="right"><span style="color:red;">*</span>Agreed Action Date同意行动的日期：</td>
        <td>
            <input type="text"   name="agreedActionDates"  id="agreedActionDates"  data-options="required:true"  onFocus="WdatePicker({isShowClear:false,isShowToday:false,readOnly:true})" class="field Wdate" />
        </td>
        <td align="right"><span style="color:red;">*</span>Capability产能：</td>
        <td>
            <input type="text" name="capability" data-options="required:true" class="easyui-validatebox"/>
        </td>
    </tr>
    <tr>
        <td align="right">Comment评论：</td>
        <td colspan="5">
            <textarea rows="3" cols="50" name="comment"></textarea>
        </td>
    </tr>
</table>
<br />
<div align="right">
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-save" onclick="save_()">Save保存</a>
    <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-no" onclick="parent.operateDialog.dialog('close');">Close关闭</a>
</div>
</body>
</html>
